<!-- 树洞详情 -->
<template>
	<view class="page">
		<TreeHole :status="1" :item="item" @zan="zan"></TreeHole>
		<view class="comments">
			<view class="count">
				{{item.hollowCommentNum}}条评论
			</view>
			<view class="list">
				<Comment @changeshowe="change" @likean="likean" :it="it" v-for="(it,index) in list.getHollowCommentList.records" :key="index"></Comment>
			</view>
		</view>
		<Evaluation v-if="!showe" :status="2" :avatar="avatar" @shuaxin="getTreeHole"></Evaluation>
		<Evaluations :status="2" v-if="showe" @changeshowe="change2"></Evaluations>
	</view>
</template>

<script>
	import TreeHole from '@/components/treeHole/treeHole.vue'
	import Comment from '@/components/comments/comment.vue'
	import Evaluation from '@/components/evaluation/evaluation.vue'
	import Evaluations from '@/components/evaluation/evaluations.vue'
	export default {
		components:{
			TreeHole,
			Comment,
			Evaluation,
			Evaluations
		},
		data() {
			return {
				item: {},
				list: [],
				qurey: {
					id: Number
				},
				showe:false,
			}
		},
		onLoad() {
			this.qurey.id = uni.getStorageSync('pageNum')
			this.getTreeHole()
		},
		methods: {
			//点击展示更多
			
			likean(id){
				this.list.forEach(item => {
					if(item.id == id){
						item.isan = true
					}
				})
			},
			//点赞
			zan(){
				this.getTreeHole()
			},
			//请求详情
			async getTreeHole(){
				let {
					data: treeHole
				} = await this.$get('/hollowList/detail',this.qurey)
				this.item = treeHole
				console.log(this.item)
				this.list = treeHole
				await console.log(this.list.getHollowCommentList.records)
			},
			change(e){
				this.showe = e
				console.log(this.showe)
			},
			change2(e){
				this.showe = e
				this.getTreeHole()
			},
			
		}
	}
</script>

<style lang="scss">
.page{
	padding-bottom: calc(75rpx + env(safe-area-inset-bottom));
	.comments{
		padding: 30rpx;
		.count{
			font-weight: bold;
			color: #333333;
			font-size: 28rpx;
		}
		.list{
			
		}
	}
}
</style>
